//==========================================================================
// Copyright (c) 2000-2008,  Elastos, Inc.  All Rights Reserved.
//==========================================================================

#if !defined (_POWER_H_)
#define _POWER_H_

class CPower : public CDeviceDriver {
public:
    CARAPI Read(
        /* [in] */ Int64 u64Offset,
        /* [in] */ Int32 bytesToRead,
        /* [out] */ MemoryBuf * pBuffer,
        /* [out] */ IEvent * * ppCompletionEvent);

    CARAPI Write(
        /* [in] */ Int64 u64Offset,
        /* [in] */ const MemoryBuf & buffer,
        /* [out] */ Int32 * pBytesWritten,
        /* [out] */ IEvent * * ppCompletionEvent);

    CARAPI Control(
        /* [in] */ Handle32 nControlCode,
        /* [in] */ const MemoryBuf & inBuffer,
        /* [out] */ MemoryBuf * pOutBuffer,
        /* [out] */ IEvent * * ppCompletionEvent);

    virtual void Dispose(){}
    void EnableAutoSleepTest(Boolean AutoTest);

};

#ifdef  __cplusplus
extern "C" {
#endif

/*for auto sleep test*/
ECode PowerCreateTimer(int *pTimerID,unsigned long Resolution,unsigned  Interval,TimerCallBackProc pCallbackProc,void * pvArg);
ECode PowerKillTimer(int TimerID);
ECode PowerStartTimer(int TimerID);
ECode PowerStopTimer(int TimerID);
ECode PowerReStartTimer(int TimerID,int Interval);
ECode PowerSetTimerInterval(int TimerID, int Interval);

#define RTSR        __REG(0x40900008)
#define PIAR        __REG(0x40900038)
#define RTCPICR     __REG(0x40900034)
#define RCNR        __REG(0x40900000)

#ifdef  __cplusplus
}
#endif

void PoSetLcdPoweroffInterval(int interval);
void  PoSetLcdPowerOn(Boolean PowerOn);
#endif
